<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use App\Models\ContentReport;
use Illuminate\Http\Request;

class ContentModerationController extends Controller
{
    /**
     * 举报内容
     */
    public function report(Request $request)
    {
        $request->validate([
            'content_type' => 'required|in:share,comment,help_request,help_answer',
            'content_id' => 'required|integer',
            'reason' => 'required|in:spam,inappropriate,harassment,other',
            'description' => 'nullable|string|max:500'
        ]);

        $report = ContentReport::create([
            'reporter_user_id' => auth()->id(),
            'content_type' => $request->content_type,
            'content_id' => $request->content_id,
            'reason' => $request->reason,
            'description' => $request->description,
            'status' => 'pending'
        ]);

        return response()->json([
            'report' => $report,
            'message' => 'Content reported successfully'
        ], 201);
    }
}